package com.github.tvbox.osc.imloader;

import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.github.tvbox.osc.R;
import com.github.tvbox.osc.base.App;
import com.github.tvbox.osc.bean.Movie;
import com.github.tvbox.osc.ui.tv.widget.RCImageView;
import com.youth.banner.adapter.BannerAdapter;
import com.youth.banner.util.BannerUtils;

import java.util.List;

import me.jessyan.autosize.utils.AutoSizeUtils;

public  class ImageNetAdapter extends BannerAdapter<Movie.Video, ImageNetAdapter.ImageHolder> {

    public ImageNetAdapter(List<Movie.Video> mDatas) {
        super(mDatas);
    }

    @Override
    public ImageHolder onCreateHolder(ViewGroup parent, int viewType) {
        RCImageView imageView = (RCImageView) BannerUtils.getView(parent, R.layout.item_user_hot_vod_new);
        return new ImageHolder(imageView);
    }

    @Override
    public void onBindView(ImageHolder holder, Movie.Video data, int position, int size) {
        //通过图片加载器实现圆角，你也可以自己使用圆角的imageview，实现圆角的方法很多，自己尝试哈
        App.getInstance().setImagePath(data.pic, holder.imageView, 620, 340, 15);
    }

    public class ImageHolder extends RecyclerView.ViewHolder {
        public RCImageView imageView;

        public ImageHolder(@NonNull View view) {
            super(view);
            this.imageView = (RCImageView) view;
        }
    }
}


